package com.ojoin.trade.supplyloan_core.web.controller;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ojoin.trade.common.utils.CommonUtils;
import com.ojoin.trade.common.web.controller.BaseController;
import com.ojoin.trade.common.web.controller.BaseControllerImpl;
import com.ojoin.trade.common.web.domain.Result;
import com.ojoin.trade.common.web.service.BaseService;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlSupplysettleaccountCheck;
import com.ojoin.trade.supplyloan_core.web.service.TbSlSupplysettleaccountCheckService;

@Controller
@RequestMapping("/supplysettleaccountcheck")
public class TbSlSupplysettleaccountCheckController extends
		BaseControllerImpl<TbSlSupplysettleaccountCheck> implements
		BaseController<TbSlSupplysettleaccountCheck> {

	private org.slf4j.Logger log = LoggerFactory
			.getLogger(TbSlSupplysettleaccountCheckController.class);

	@Autowired
	private TbSlSupplysettleaccountCheckService service;
 
	@Override
	protected BaseService<TbSlSupplysettleaccountCheck> getBaseService() {

		return service;
	}
 
	@ResponseBody
	@RequestMapping(value = "/operate/queryById", method = {RequestMethod.GET,RequestMethod.POST})
	public Result queryById(String idOfPlatformUser,String time) { 
		log.info("idOfPlatformUser->"+idOfPlatformUser+"time->"+time); 
		try { 
			TbSlSupplysettleaccountCheck tbs = new TbSlSupplysettleaccountCheck();
			tbs.setCheckDate(time); 
			if(!CommonUtils.isEmpty(idOfPlatformUser)){
				tbs.setIdOfPlatformUser(Integer.valueOf(idOfPlatformUser));
			}
		
		
			TbSlSupplysettleaccountCheck tbsl = service.queryOne(tbs); 
			return new Result(Result.Status.OK, tbsl); 
		} catch (Exception e) {
			log.error("", e); 
			return new Result(Result.Status.ERROR, "");
		}

	}
	
}
